OnEvent.add(window, "beforeunload", function() {
	OnEvent.clear();
});

OnEvent.add(window, "load", function() {
	smartFocus();
	restrictionNotifier();
	fxEngine = new zEngines;
	evEngine = new zEventController;

	var wheelEvent = (Browser.safari || Browser.chrome) ? "mousewheel" : (Browser.mozilla) ? "DOMMouseScroll" : "mousewheel";
	OnEvent.add(window.document, wheelEvent, BindEvent(evEngine, evEngine.hijack));
	OnEvent.add(window.document, "keyup", BindEvent(evEngine, evEngine.hijack));

	// collect prayer boards
	var pcw = document.getElementById(CONTAINER_WRAPPER_ID);
	if(pcw) {
		for(var i=0; i<pcw.childNodes.length; i++) {
			if(/prayer_list/.test(pcw.childNodes[i].className)) {
				PRAYER_CONTAINERS.push (pcw.childNodes[i]);
			}
		}

		// detect current activated board
		detectCurrentContainer();
		defineMinX();
	}



	// detect which prayer board activated

	// new topic prayer focus/blur effects.
//	OnEvent.add($("prayer_topic"), "focus", BindEvent(this, function(_e) {
//		var input = new Eventor(_e)._node();
//		var label = document.getElementById("prayer_topic_label")
//		label.innerHTML = "Share Your Prayer"; 
//		input.style.borderColor = label.style.backgroundColor = "#687993";
//		input.style.backgroundColor = "#fff";
//	}));
//
//	OnEvent.add($("prayer_topic"), "blur", BindEvent(this, function(_e) {
//		var input = new Eventor(_e)._node();
//		var label = document.getElementById("prayer_topic_label")
//		label.innerHTML = "Hit Enter to share your prayer"; 
//		input.style.borderColor = label.style.backgroundColor = "#9DADC7";
//		input.style.backgroundColor = "#ddd";
//	}));

});
